
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2283. -- [Sdoi2011]火星移民 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2283: [Sdoi2011]火星移民</h2><span class=green>Time Limit: </span>40 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>512 MB<br><span class=green>Submit: </span>35&nbsp;&nbsp;<span class=green>Solved: </span>13<br>[<a href='submitpage.php?id=2283'>Submit</a>][<a href='problemstatus.php?id=2283'>Status</a>][<a href='bbs.php?id=2283'>Discuss</a>]</center><h2>Description</h2><div class=content><h1 align="center" style="margin: 17pt 0cm 16.5pt; text-align: center"><span style="font-size: medium"><span style="font-family: 宋体">在</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">2xyz</span><span style="font-family: 宋体">年，人类已经移民到了火星上。由于工业的需要，人们开始在火星上采矿。火星的矿区是一个边长为</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">N</span><span style="font-family: 宋体">的正六边形，为了方便规划，整个矿区被分为</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">6*N*N</span><span style="font-family: 宋体">个正三角形的区域（如图</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="font-family: 宋体">）。</span></span></h1>
<p><img height="303" alt="" width="574" src="/JudgeOnline/upload/201105/image/2283.jpg" /></p>
<h1 align="center" style="margin: 17pt 0cm 16.5pt; text-align: center"><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></h1>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p>
<p></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p></p>
<p></p>
<p class="NOI" style="margin: 13pt 0cm"></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
</p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style="width: 407.25pt; height: 228.75pt"><v:imagedata o:title="" src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\01\clip_image001.png"></v:imagedata></v:shape><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">整个矿区中存在</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="font-family: 宋体">矿，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">B</span><span style="font-family: 宋体">矿，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">C</span><span style="font-family: 宋体">矿三个矿场，和</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">a</span><span style="font-family: 宋体">厂，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">b</span><span style="font-family: 宋体">厂，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">c</span><span style="font-family: 宋体">厂三个炼矿厂。每个三角形的区域可以是一个矿场、炼矿厂、山地、或者平地。现在矿区管理局要求建立一个交通系统，使得矿场和对应炼矿厂之间存在一条公路，并且三条公路互不交叉</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">(</span><span style="font-family: 宋体">即一个三角形区域中不存在两条以上运输不同矿的公路</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">)</span><span style="font-family: 宋体">。两个三角形区域是相邻的当且仅当这两个三角形存在公共边，只有相邻的两个区域之间才能建一段路，建这段路的费用为</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="font-family: 宋体">。注意，山地上是不能建公路的。由于火星金融危机的影响，矿区管理局想知道建立这样一个交通系统最少要花多少费用。更多的，当局向知道有多少种花费最小的方案。</span></span></p></div><h2>Input</h2><div class=content><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">第</span><span lang="EN-US" style="font-family: 'Times New Roman'">1</span><span style="font-family: 宋体">行一个整数</span><span lang="EN-US" style="font-family: 'Times New Roman'">N</span><span style="font-family: 宋体">。表示这个矿区是边长为</span><span lang="EN-US" style="font-family: 'Times New Roman'">N</span><span style="font-family: 宋体">的正六边形。</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">接下来有</span><span lang="EN-US" style="font-family: 'Times New Roman'">6*N*N</span><span style="font-family: 宋体">的整数，分为</span><span lang="EN-US" style="font-family: 'Times New Roman'">2*N</span><span style="font-family: 宋体">行，表示矿区当前区域的情况。</span><span lang="EN-US" style="font-family: 'Times New Roman'">0</span><span style="font-family: 宋体">表示平地，</span><span lang="EN-US" style="font-family: 'Times New Roman'">1,2,3</span><span style="font-family: 宋体">表示对应的矿区或者炼矿厂，</span><span lang="EN-US" style="font-family: 'Times New Roman'">4</span><span style="font-family: 宋体">表示山地。（样例</span><span lang="EN-US" style="font-family: 'Times New Roman'">1</span><span style="font-family: 宋体">对应图</span><span lang="EN-US" style="font-family: 'Times New Roman'">2</span><span style="font-family: 宋体">）。可能有多组数据，请处理到文件结尾</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p></div><h2>Output</h2><div class=content><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">对于每组数据，包含两个整数，表示最小费用和达到最小费用的方案数。如果找不到符合要求的方案，输出</span><span lang="EN-US" style="font-family: 'Times New Roman'">-1 -1</span><span style="font-family: 宋体">。由于方案数可能过大，所以请把方案数</span><span lang="EN-US" style="font-family: 'Times New Roman'">mod 1000000007</span><span style="font-family: 宋体">。</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p class="NOI" style="margin: 13pt 0cm"></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: x-small"><span lang="EN-US" style="font-family: 'Times New Roman'"><o:p><span style="font-size: medium">&nbsp;</span></o:p></span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p><span id="1303651686958E" style="display: none">&nbsp;</span></p>
<p></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p><span style="font-size: medium"><span style="font-family: 黑体">【数据规模和约定】</span></span></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>【样例输入1】<br />
<br />
2<br />
<br />
0 1 0 0 0<br />
<br />
0 0 2 0 4 0 0<br />
<br />
0 0 4 3 0 3 2<br />
<br />
0 0 0 1 0<br />
<br />
 <br />
<br />
<br />
【样例输出1】<br />
<br />
<br />
18 1<br />
<br />
 <br />
<br />
<br />
【样例输入2】<br />
<br />
<br />
3<br />
<br />
0 0 0 1 0 0 0<br />
<br />
0 0 0 0 0 0 0 0 0<br />
<br />
0 0 2 0 0 0 0 0 0 0 0<br />
<br />
0 0 0 0 0 0 3 0 0 0 0<br />
<br />
0 0 0 0 0 0 0 0 0<br />
<br />
0 3 0 1 0 2 0<br />
<br />
 <br />
<br />
<br />
【样例输出2】<br />
<br />
<br />
44 1<br />
 <br />
 <br />
<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata></span></div><h2>HINT</h2>
			<div class=content><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt">样例2的解释</p><br />
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p><br />
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><a href="/JudgeOnline/upload/201105/file/2283_1.jpg"><img height="412" alt="" width="416" src="/JudgeOnline/upload/201105/image/2283_1.jpg" /></a></p><br />
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">对于</span><span lang="EN-US" style="font-family: 'Times New Roman'">100%</span><span style="font-family: 宋体">的数据，</span><span lang="EN-US" style="font-family: 'Times New Roman'">N&le;6</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=stage 2 day1'>stage 2 day1</a></p></div><center>[<a href='submitpage.php?id=2283'>Submit</a>][<a href='problemstatus.php?id=2283'>Status</a>][<a href='bbs.php?id=2283'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
